return v;
}
+SwapNodes.prototype.decode_float = function() {
+ var v = this.node_data.getFloat32(this.data_pos, true);
+ this.data_pos += 4;
+ return v;
+}
+
SwapNodes.prototype.decode_color = function() {
var rgba = this.decode_uint32();
var a = (rgba >> 24) & 0xff;
return c;
}
-SwapNodes.prototype.decode_float = function() {
- return this.decode_int32() / 256.0;
-}
-
SwapNodes.prototype.decode_size = function() {
var s = new Object();
s.width = this.decode_float ();
return texture;
}
+/* uint32 is sent in native endianness, and then converted to little endian in broadwayd when sending to browser */
static void
add_uint32 (GArray *nodes, guint32 v)
{
g_array_append_val (nodes, v);
}
+static void
+add_float (GArray *nodes, float f)
+{
+ union {
+ float f;
+ guint32 i;
+ } u;
+
+ u.f = f;
+ g_array_append_val (nodes, u.i);
+}
+
static guint32
rgba_to_uint32 (const GdkRGBA *rgba)
{
g_array_append_val (nodes, c);
}
-static void
-add_float (GArray *nodes, float f)
-{
- gint32 i = (gint32) (f * 256.0f);
- guint u = (guint32) i;
- g_array_append_val (nodes, u);
-}
-
static void
add_xy (GArray *nodes, float x, float y, float offset_x, float offset_y)
{